How to delete all out links created by a specific user?

A user linked all current objects to an old baseline in a module incorrectly, How to delete these out links by using DXL script?

I have a script which can capture these links to the attribute, I use the attribute to filter the links and found there are 2004 links need to be deleted.

Can I delete these links based on this attribute? What factors should be considered?

Are there any easier ways? Is it possible to delete these links based on 'Created By'? Like the following:

Module m = current

Object o

for o in m do{

Link l

for l in o -> "*" do {

string user = l."Created By"

if (user =="Username ABC"){

delete l}

}

}

Is there anything I haven't considered?

Thanks in advance!

Luke


Happy2018 - Fri Mar 29 02:34:43 EDT 2019

Re: How to delete all out links created by a specific user?
llandale - Tue Apr 02 17:48:45 EDT 2019

Maybe get the "Created On" of then link to make sure you aren't deleting old links.

But, Deleting Links inside the Link loop is a no-no.

Skip skpLinksToDelete = create()   // KEY and DATA both 'link'

Replace "delete l" with "put(skpsLinksToDelete, l, l)"

Add:

for l in skpLinksToDelete do { delete(l)}

delete(skpLinksToDelete)

flushDeletions

-Louie